#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by master on 2017/3/4

# 对pickle的进一步封装

import shelve

d = shelve.open("shelve_test")


class Test(object):
    def __init__(self, n):
        self.n = n


t = Test(123)

t2 = Test(12345)

name = ["alex", "rain", "test"]

d["test"] = name  # 持久化列表
d["t1"] = t  # 持久化类
d["t2"] = t2

d.close()
